<template>
  <a-tree
    checkable
    :tree-data="treeData"
    :default-expanded-keys="expanded"
    :default-selected-keys="selected"
    :default-checked-keys="checked"
    :replace-fields="replaceFields"
    @select="onSelect"
    @check="onCheck"
  />
</template>
<script>


export default {
  props:{
    treeData:{
      type:Array,
      default:()=>([])
    }
  },
  data() {
    return {
      checked:[],
      selected:[],
      expanded:[],
      replaceFields: {
        children: 'children',
        title: 'title',
        key:"id"
      },
    };
  },
  methods: {
    onSelect(selectedKeys, info) {
  
      this.$emit('selected-Key', selectedKeys[0]);
      // console.log('selected', selectedKeys, info);
    },
    onCheck(checkedKeys, info) {
      console.log('onCheck', checkedKeys, info);
    },
  },
};
</script>
